package com.example.schedule.schedule.service;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashSet;

@Service
public class ScheduleService {

    // 每隔两秒执行一次
    @Scheduled(fixedRate = 2000)
    public void schedule1(){
        System.out.println("fixedRate" + new Date());
    }

    @Scheduled(cron = "0 28 11 ? * *")
    public void schedule2(){
        System.out.println("cron" + new Date());
    }
}
